import pandas as pd
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
import geopandas
import geopandas as gdp
# uses the "nybb" dataset, a map of New York boroughs,
# which is part of the GeoPandas installation.
path_to_data = geopandas.datasets.get_path("nybb")
gdf = geopandas.read_file(path_to_data)
gdf
# imported vector files
| BoroCode | BoroName | Shape_Leng | Shape_Area | geometry | |
|---|---|---|---|---|---|
| 0 | 5 | Staten Island | 330470.010332 | 1.623820e+09 | MULTIPOLYGON (((970217.022 145643.332, 970227.... |
| 1 | 4 | Queens | 896344.047763 | 3.045213e+09 | MULTIPOLYGON (((1029606.077 156073.814, 102957... |
| 2 | 3 | Brooklyn | 741080.523166 | 1.937479e+09 | MULTIPOLYGON (((1021176.479 151374.797, 102100... |
| 3 | 1 | Manhattan | 359299.096471 | 6.364715e+08 | MULTIPOLYGON (((981219.056 188655.316, 980940.... |
| 4 | 2 | Bronx | 464392.991824 | 1.186925e+09 | MULTIPOLYGON (((1012821.806 229228.265, 101278... |
type(gdf)
geopandas.geodataframe.GeoDataFrame
gdf.geometry.values
<GeometryArray> [<shapely.geometry.multipolygon.MultiPolygon object at 0x000001561CB82670>, <shapely.geometry.multipolygon.MultiPolygon object at 0x000001561CB78520>, <shapely.geometry.multipolygon.MultiPolygon object at 0x000001566C119640>, <shapely.geometry.multipolygon.MultiPolygon object at 0x000001561CB82A00>, <shapely.geometry.multipolygon.MultiPolygon object at 0x000001561C9A8C10>] Length: 5, dtype: geometry
gdf.crs
<Projected CRS: EPSG:2263> Name: NAD83 / New York Long Island (ftUS) Axis Info [cartesian]: - X[east]: Easting (US survey foot) - Y[north]: Northing (US survey foot) Area of Use: - name: United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk. - bounds: (-74.26, 40.47, -71.8, 41.3) Coordinate Operation: - name: SPCS83 New York Long Island zone (US Survey feet) - method: Lambert Conic Conformal (2SP) Datum: North American Datum 1983 - Ellipsoid: GRS 1980 - Prime Meridian: Greenwich
help(gdf.to_crs)
Help on method to_crs in module geopandas.geodataframe:
to_crs(crs=None, epsg=None, inplace=False) method of geopandas.geodataframe.GeoDataFrame instance
Transform geometries to a new coordinate reference system.
Transform all geometries in an active geometry column to a different coordinate
reference system. The ``crs`` attribute on the current GeoSeries must
be set. Either ``crs`` or ``epsg`` may be specified for output.
This method will transform all points in all objects. It has no notion
or projecting entire geometries. All segments joining points are
assumed to be lines in the current projection, not geodesics. Objects
crossing the dateline (or other projection boundary) will have
undesirable behavior.
Parameters
----------
crs : pyproj.CRS, optional if `epsg` is specified
The value can be anything accepted by
:meth:`pyproj.CRS.from_user_input() <pyproj.crs.CRS.from_user_input>`,
such as an authority string (eg "EPSG:4326") or a WKT string.
epsg : int, optional if `crs` is specified
EPSG code specifying output projection.
inplace : bool, optional, default: False
Whether to return a new GeoDataFrame or do the transformation in
place.
Returns
-------
GeoDataFrame
Examples
--------
>>> from shapely.geometry import Point
>>> d = {'col1': ['name1', 'name2'], 'geometry': [Point(1, 2), Point(2, 1)]}
>>> gdf = geopandas.GeoDataFrame(d, crs=4326)
>>> gdf
col1 geometry
0 name1 POINT (1.00000 2.00000)
1 name2 POINT (2.00000 1.00000)
>>> gdf.crs # doctest: +SKIP
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
>>> gdf = gdf.to_crs(3857)
>>> gdf
col1 geometry
0 name1 POINT (111319.491 222684.209)
1 name2 POINT (222638.982 111325.143)
>>> gdf.crs # doctest: +SKIP
<Projected CRS: EPSG:3857>
Name: WGS 84 / Pseudo-Mercator
Axis Info [cartesian]:
- X[east]: Easting (metre)
- Y[north]: Northing (metre)
Area of Use:
- name: World - 85°S to 85°N
- bounds: (-180.0, -85.06, 180.0, 85.06)
Coordinate Operation:
- name: Popular Visualisation Pseudo-Mercator
- method: Popular Visualisation Pseudo Mercator
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
See also
--------
GeoDataFrame.set_crs : assign CRS without re-projection
gdf.plot(color='green', edgecolor ='black');
gdf.plot(cmap='jet', edgecolor ='black', column = 'BoroName');
gdf.plot(cmap='jet',
edgecolor ='black',
column = 'BoroName',
figsize=(10,100));
ax = gdf.plot(cmap='jet',
edgecolor ='red',
column = 'BoroName',
figsize=(10,100));
ax.axis('off');
gdf.plot(cmap='jet', edgecolor ='black', column = 'BoroName');
gdf.geometry[0] # lower left
gdf.geometry[1]
gdf.geometry[2]
gdf.geometry[3]
gdf.geometry[4]
# gdf.to_file("my_file.geojson", driver="GeoJSON")
gdf = gdf.set_index("BoroName")
gdf
| BoroCode | Shape_Leng | Shape_Area | geometry | |
|---|---|---|---|---|
| BoroName | ||||
| Staten Island | 5 | 330470.010332 | 1.623820e+09 | MULTIPOLYGON (((970217.022 145643.332, 970227.... |
| Queens | 4 | 896344.047763 | 3.045213e+09 | MULTIPOLYGON (((1029606.077 156073.814, 102957... |
| Brooklyn | 3 | 741080.523166 | 1.937479e+09 | MULTIPOLYGON (((1021176.479 151374.797, 102100... |
| Manhattan | 1 | 359299.096471 | 6.364715e+08 | MULTIPOLYGON (((981219.056 188655.316, 980940.... |
| Bronx | 2 | 464392.991824 | 1.186925e+09 | MULTIPOLYGON (((1012821.806 229228.265, 101278... |
gdf["area"] = gdf.area
gdf["area"]
BoroName Staten Island 1.623822e+09 Queens 3.045214e+09 Brooklyn 1.937478e+09 Manhattan 6.364712e+08 Bronx 1.186926e+09 Name: area, dtype: float64
gdf['boundary'] = gdf.boundary
gdf['boundary']
BoroName Staten Island MULTILINESTRING ((970217.022 145643.332, 97022... Queens MULTILINESTRING ((1029606.077 156073.814, 1029... Brooklyn MULTILINESTRING ((1021176.479 151374.797, 1021... Manhattan MULTILINESTRING ((981219.056 188655.316, 98094... Bronx MULTILINESTRING ((1012821.806 229228.265, 1012... Name: boundary, dtype: geometry
gdf['centroid'] = gdf.centroid
gdf['centroid']
BoroName Staten Island POINT (941639.450 150931.991) Queens POINT (1034578.078 197116.604) Brooklyn POINT (998769.115 174169.761) Manhattan POINT (993336.965 222451.437) Bronx POINT (1021174.790 249937.980) Name: centroid, dtype: geometry
first_point = gdf['centroid'].iloc[0]
gdf['distance'] = gdf['centroid'].distance(first_point)
gdf['distance']
BoroName Staten Island 0.000000 Queens 103781.535276 Brooklyn 61674.893421 Manhattan 88247.742789 Bronx 126996.283623 Name: distance, dtype: float64
gdf['distance'].mean()
76140.09102166798
gdf.plot("area", legend=True);
gdf.explore("area", legend=False)
gdf = gdf.set_geometry("centroid")
gdf.plot("area", legend=True);
ax = gdf["geometry"].plot()
gdf["centroid"].plot(ax=ax, color="black");
gdf = gdf.set_geometry("geometry")
# ex: countries_gdf.to_file("countries.shp")
# ex: countries_gdf.to_file("countries.geojson", driver='GeoJSON')
gdf.crs
<Projected CRS: EPSG:2263> Name: NAD83 / New York Long Island (ftUS) Axis Info [cartesian]: - X[east]: Easting (US survey foot) - Y[north]: Northing (US survey foot) Area of Use: - name: United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk. - bounds: (-74.26, 40.47, -71.8, 41.3) Coordinate Operation: - name: SPCS83 New York Long Island zone (US Survey feet) - method: Lambert Conic Conformal (2SP) Datum: North American Datum 1983 - Ellipsoid: GRS 1980 - Prime Meridian: Greenwich
gdf.geometry
BoroName Staten Island MULTIPOLYGON (((970217.022 145643.332, 970227.... Queens MULTIPOLYGON (((1029606.077 156073.814, 102957... Brooklyn MULTIPOLYGON (((1021176.479 151374.797, 102100... Manhattan MULTIPOLYGON (((981219.056 188655.316, 980940.... Bronx MULTIPOLYGON (((1012821.806 229228.265, 101278... Name: geometry, dtype: geometry
type(gdf.geometry)
geopandas.geoseries.GeoSeries
gdf.geometry.area
BoroName Staten Island 1.623822e+09 Queens 3.045214e+09 Brooklyn 1.937478e+09 Manhattan 6.364712e+08 Bronx 1.186926e+09 dtype: float64
gdf.geometry.name
'geometry'
gdf.crs
<Projected CRS: EPSG:2263> Name: NAD83 / New York Long Island (ftUS) Axis Info [cartesian]: - X[east]: Easting (US survey foot) - Y[north]: Northing (US survey foot) Area of Use: - name: United States (USA) - New York - counties of Bronx; Kings; Nassau; New York; Queens; Richmond; Suffolk. - bounds: (-74.26, 40.47, -71.8, 41.3) Coordinate Operation: - name: SPCS83 New York Long Island zone (US Survey feet) - method: Lambert Conic Conformal (2SP) Datum: North American Datum 1983 - Ellipsoid: GRS 1980 - Prime Meridian: Greenwich
import pandas as pd
import geopandas
import matplotlib.pyplot as plt
df = pd.DataFrame(
{'City': ['Buenos Aires', 'Brasilia', 'Santiago', 'Bogota', 'Caracas'],
'Country': ['Argentina', 'Brazil', 'Chile', 'Colombia', 'Venezuela'],
'Latitude': [-34.58, -15.78, -33.45, 4.60, 10.48],
'Longitude': [-58.66, -47.91, -70.66, -74.08, -66.86]})
gdf = geopandas.GeoDataFrame(
df, geometry=geopandas.points_from_xy(df.Longitude, df.Latitude))
print(gdf.head())
City Country Latitude Longitude geometry 0 Buenos Aires Argentina -34.58 -58.66 POINT (-58.66000 -34.58000) 1 Brasilia Brazil -15.78 -47.91 POINT (-47.91000 -15.78000) 2 Santiago Chile -33.45 -70.66 POINT (-70.66000 -33.45000) 3 Bogota Colombia 4.60 -74.08 POINT (-74.08000 4.60000) 4 Caracas Venezuela 10.48 -66.86 POINT (-66.86000 10.48000)
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
# We restrict to South America.
ax = world[world.continent == 'South America'].plot(
color='white', edgecolor='black')
# We can now plot our ``GeoDataFrame``.
gdf.plot(ax=ax, color='red')
plt.show()
url = "http://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_land.geojson"
df2 = geopandas.read_file(url)
df2.plot();
url = "http://d2ad6b4ur7yvpq.cloudfront.net/naturalearth-3.3.0/ne_110m_land.geojson"
dfg = geopandas.read_file(url)
dfg.head(10)
| scalerank | featureclass | geometry | |
|---|---|---|---|
| 0 | 1 | Country | POLYGON ((-59.57209 -80.04018, -59.86585 -80.5... |
| 1 | 1 | Country | POLYGON ((-159.20818 -79.49706, -161.12760 -79... |
| 2 | 1 | Country | POLYGON ((-45.15476 -78.04707, -43.92083 -78.4... |
| 3 | 1 | Country | POLYGON ((-121.21151 -73.50099, -119.91885 -73... |
| 4 | 1 | Country | POLYGON ((-125.55957 -73.48135, -124.03188 -73... |
| 5 | 1 | Country | POLYGON ((-98.98155 -71.93333, -97.88474 -72.0... |
| 6 | 1 | Country | POLYGON ((-68.45135 -70.95582, -68.33383 -71.4... |
| 7 | 1 | Country | POLYGON ((-58.61414 -64.15247, -59.04507 -64.3... |
| 8 | 1 | Country | POLYGON ((-67.75000 -53.85000, -66.45000 -54.4... |
| 9 | 1 | Country | POLYGON ((-58.55000 -51.10000, -57.75000 -51.5... |
dfg.geometry[0]
dfg.geometry[1]
dfg.plot();
world = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))
cities = geopandas.read_file(geopandas.datasets.get_path('naturalearth_cities'))
world.head()
| pop_est | continent | name | iso_a3 | gdp_md_est | geometry | |
|---|---|---|---|---|---|---|
| 0 | 920938 | Oceania | Fiji | FJI | 8374.0 | MULTIPOLYGON (((180.00000 -16.06713, 180.00000... |
| 1 | 53950935 | Africa | Tanzania | TZA | 150600.0 | POLYGON ((33.90371 -0.95000, 34.07262 -1.05982... |
| 2 | 603253 | Africa | W. Sahara | ESH | 906.5 | POLYGON ((-8.66559 27.65643, -8.66512 27.58948... |
| 3 | 35623680 | North America | Canada | CAN | 1674000.0 | MULTIPOLYGON (((-122.84000 49.00000, -122.9742... |
| 4 | 326625791 | North America | United States of America | USA | 18560000.0 | MULTIPOLYGON (((-122.84000 49.00000, -120.0000... |
world.plot();
world = world[(world.pop_est>0) & (world.name!="Antarctica")]
world['gdp_per_cap'] = world.gdp_md_est / world.pop_est
world.plot(column='gdp_per_cap');
C:\Users\tbresee\Anaconda3\lib\site-packages\geopandas\geodataframe.py:1351: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy super().__setitem__(key, value)
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1, 1)
world.plot(column='pop_est', ax=ax, legend=True);
world.plot(column='gdp_per_cap', cmap='OrRd');
world.boundary.plot();
world.plot(column='gdp_per_cap', cmap='OrRd', scheme='quantiles');
ax = world.plot()
ax = world.plot()
ax.set_axis_off();
cities.plot(marker='*', color='green', markersize=5);
cities = cities.to_crs(world.crs)
base = world.plot(color='white', edgecolor='black')
cities.plot(ax=base, marker='o', color='red', markersize=5);
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.set_aspect('equal')
world.plot(ax=ax, color='white', edgecolor='black')
cities.plot(ax=ax, marker='o', color='red', markersize=5)
plt.show();
from shapely.geometry import Point
%matplotlib inline
list(dir(gdf))
['City', 'Country', 'Latitude', 'Longitude', 'T', '_AXIS_LEN', '_AXIS_ORDERS', '_AXIS_REVERSED', '_AXIS_TO_AXIS_NUMBER', '_HANDLED_TYPES', '__abs__', '__add__', '__and__', '__annotations__', '__array__', '__array_priority__', '__array_ufunc__', '__array_wrap__', '__bool__', '__class__', '__contains__', '__copy__', '__deepcopy__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__divmod__', '__doc__', '__eq__', '__finalize__', '__floordiv__', '__format__', '__ge__', '__geo_interface__', '__getattr__', '__getattribute__', '__getitem__', '__getstate__', '__gt__', '__hash__', '__iadd__', '__iand__', '__ifloordiv__', '__imod__', '__imul__', '__init__', '__init_subclass__', '__invert__', '__ior__', '__ipow__', '__isub__', '__iter__', '__itruediv__', '__ixor__', '__le__', '__len__', '__lt__', '__matmul__', '__mod__', '__module__', '__mul__', '__ne__', '__neg__', '__new__', '__nonzero__', '__or__', '__pos__', '__pow__', '__radd__', '__rand__', '__rdivmod__', '__reduce__', '__reduce_ex__', '__repr__', '__rfloordiv__', '__rmatmul__', '__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__', '__rsub__', '__rtruediv__', '__rxor__', '__setattr__', '__setitem__', '__setstate__', '__sizeof__', '__str__', '__sub__', '__subclasshook__', '__truediv__', '__weakref__', '__xor__', '_accessors', '_accum_func', '_add_numeric_operations', '_agg_by_level', '_agg_examples_doc', '_agg_summary_and_see_also_doc', '_align_frame', '_align_series', '_arith_method', '_as_manager', '_attrs', '_box_col_values', '_can_fast_transpose', '_check_inplace_and_allows_duplicate_labels', '_check_inplace_setting', '_check_is_chained_assignment_possible', '_check_label_or_level_ambiguity', '_check_setitem_copy', '_clear_item_cache', '_clip_with_one_bound', '_clip_with_scalar', '_cmp_method', '_combine_frame', '_consolidate', '_consolidate_inplace', '_construct_axes_dict', '_construct_axes_from_arguments', '_construct_result', '_constructor', '_constructor_sliced', '_convert', '_count_level', '_crs', '_data', '_dir_additions', '_dir_deletions', '_dispatch_frame_op', '_drop_axis', '_drop_labels_or_levels', '_ensure_valid_index', '_find_valid_index', '_flags', '_from_arrays', '_from_mgr', '_geometry_column_name', '_get_agg_axis', '_get_axis', '_get_axis_name', '_get_axis_number', '_get_axis_resolvers', '_get_block_manager_axis', '_get_bool_data', '_get_cleaned_column_resolvers', '_get_column_array', '_get_geometry', '_get_index_resolvers', '_get_item_cache', '_get_label_or_level_values', '_get_numeric_data', '_get_value', '_getitem_bool_array', '_getitem_multilevel', '_gotitem', '_hidden_attrs', '_indexed_same', '_info_axis', '_info_axis_name', '_info_axis_number', '_info_repr', '_init_mgr', '_inplace_method', '_internal_names', '_internal_names_set', '_is_copy', '_is_homogeneous_type', '_is_label_or_level_reference', '_is_label_reference', '_is_level_reference', '_is_mixed_type', '_is_view', '_iset_item', '_iset_item_mgr', '_iset_not_inplace', '_item_cache', '_iter_column_arrays', '_ixs', '_join_compat', '_logical_func', '_logical_method', '_maybe_cache_changed', '_maybe_update_cacher', '_metadata', '_mgr', '_min_count_stat_function', '_needs_reindex_multi', '_protect_consolidate', '_reduce', '_reindex_axes', '_reindex_columns', '_reindex_index', '_reindex_multi', '_reindex_with_indexers', '_replace_columnwise', '_repr_data_resource_', '_repr_fits_horizontal_', '_repr_fits_vertical_', '_repr_html_', '_repr_latex_', '_reset_cache', '_reset_cacher', '_sanitize_column', '_series', '_set_axis', '_set_axis_name', '_set_axis_nocheck', '_set_geometry', '_set_is_copy', '_set_item', '_set_item_frame_value', '_set_item_mgr', '_set_value', '_setitem_array', '_setitem_frame', '_setitem_slice', '_slice', '_stat_axis', '_stat_axis_name', '_stat_axis_number', '_stat_function', '_stat_function_ddof', '_take_with_is_copy', '_to_dict_of_blocks', '_to_geo', '_typ', '_update_inplace', '_validate_dtype', '_values', '_where', 'abs', 'add', 'add_prefix', 'add_suffix', 'affine_transform', 'agg', 'aggregate', 'align', 'all', 'any', 'append', 'apply', 'applymap', 'area', 'asfreq', 'asof', 'assign', 'astype', 'at', 'at_time', 'attrs', 'axes', 'backfill', 'between_time', 'bfill', 'bool', 'boundary', 'bounds', 'boxplot', 'buffer', 'cascaded_union', 'centroid', 'clip', 'columns', 'combine', 'combine_first', 'compare', 'contains', 'convert_dtypes', 'convex_hull', 'copy', 'corr', 'corrwith', 'count', 'cov', 'covered_by', 'covers', 'crosses', 'crs', 'cummax', 'cummin', 'cumprod', 'cumsum', 'cx', 'describe', 'diff', 'difference', 'disjoint', 'dissolve', 'distance', 'div', 'divide', 'dot', 'drop', 'drop_duplicates', 'droplevel', 'dropna', 'dtypes', 'duplicated', 'empty', 'envelope', 'eq', 'equals', 'estimate_utm_crs', 'eval', 'ewm', 'expanding', 'explode', 'explore', 'exterior', 'ffill', 'fillna', 'filter', 'first', 'first_valid_index', 'flags', 'floordiv', 'from_dict', 'from_features', 'from_file', 'from_postgis', 'from_records', 'ge', 'geom_almost_equals', 'geom_equals', 'geom_equals_exact', 'geom_type', 'geometry', 'get', 'groupby', 'gt', 'has_sindex', 'has_z', 'head', 'hist', 'iat', 'idxmax', 'idxmin', 'iloc', 'index', 'infer_objects', 'info', 'insert', 'interiors', 'interpolate', 'intersection', 'intersects', 'is_empty', 'is_ring', 'is_simple', 'is_valid', 'isin', 'isna', 'isnull', 'items', 'iterfeatures', 'iteritems', 'iterrows', 'itertuples', 'join', 'keys', 'kurt', 'kurtosis', 'last', 'last_valid_index', 'le', 'length', 'loc', 'lookup', 'lt', 'mad', 'mask', 'max', 'mean', 'median', 'melt', 'memory_usage', 'merge', 'min', 'mod', 'mode', 'mul', 'multiply', 'ndim', 'ne', 'nlargest', 'notna', 'notnull', 'nsmallest', 'nunique', 'overlaps', 'overlay', 'pad', 'pct_change', 'pipe', 'pivot', 'pivot_table', 'plot', 'pop', 'pow', 'prod', 'product', 'project', 'quantile', 'query', 'radd', 'rank', 'rdiv', 'reindex', 'reindex_like', 'relate', 'rename', 'rename_axis', 'rename_geometry', 'reorder_levels', 'replace', 'representative_point', 'resample', 'reset_index', 'rfloordiv', 'rmod', 'rmul', 'rolling', 'rotate', 'round', 'rpow', 'rsub', 'rtruediv', 'sample', 'scale', 'select_dtypes', 'sem', 'set_axis', 'set_crs', 'set_flags', 'set_geometry', 'set_index', 'shape', 'shift', 'simplify', 'sindex', 'size', 'sjoin', 'sjoin_nearest', 'skew', 'slice_shift', 'sort_index', 'sort_values', 'squeeze', 'stack', 'std', 'style', 'sub', 'subtract', 'sum', 'swapaxes', 'swaplevel', 'symmetric_difference', 'tail', 'take', 'to_clipboard', 'to_crs', 'to_csv', 'to_dict', 'to_excel', 'to_feather', 'to_file', 'to_gbq', 'to_hdf', 'to_html', 'to_json', 'to_latex', 'to_markdown', 'to_numpy', 'to_parquet', 'to_period', 'to_pickle', 'to_postgis', 'to_records', 'to_sql', 'to_stata', 'to_string', 'to_timestamp', 'to_wkb', 'to_wkt', 'to_xarray', 'to_xml', 'total_bounds', 'touches', 'transform', 'translate', 'transpose', 'truediv', 'truncate', 'type', 'tz_convert', 'tz_localize', 'unary_union', 'union', 'unstack', 'update', 'value_counts', 'values', 'var', 'where', 'within', 'xs']
help(geopandas)
Help on package geopandas:
NAME
geopandas
PACKAGE CONTENTS
_compat
_config
_decorator
_vectorized
_version
array
base
conftest
datasets (package)
explore
geodataframe
geoseries
io (package)
plotting
sindex
testing
tests (package)
tools (package)
DATA
options = Options(
display_precision: None [default: Non...USE_PYGEO...
VERSION
0.10.2
FILE
c:\users\tbresee\anaconda3\lib\site-packages\geopandas\__init__.py
# states = gdp.read_file('some.shp')
z = gdp.read_file(r'D:\mexico\cities.shp') # only because it needed all the other files
z
| NAME | CAPITAL | STATE_NAME | POPULATION | geometry | |
|---|---|---|---|---|---|
| 0 | Monterrey | Y | Nuevo Leon | 2015000 | POINT (-100.31709 25.67735) |
| 1 | Mazatlan | N | Sinaloa | 199830 | POINT (-106.41607 23.20383) |
| 2 | Guadalajara | Y | Jalisco | 2325000 | POINT (-103.34380 20.67359) |
| 3 | Tampico | N | Tamaulipas | 435000 | POINT (-97.84263 22.24323) |
| 4 | Mexico City | C | Distrito Federal | 14100000 | POINT (-99.12757 19.42705) |
| 5 | Puebla de Zaragoza | Y | Puebla | 1055000 | POINT (-98.19295 19.04863) |
| 6 | Veracruz | N | Veracruz-Llave | 385000 | POINT (-96.08524 19.00683) |
| 7 | Oaxaca | Y | Oaxaca | 154223 | POINT (-96.95135 16.90743) |
| 8 | Merida | Y | Yucatan | 400142 | POINT (-89.55286 20.82187) |
| 9 | Mexicali | Y | Baja California Norte | 365000 | POINT (-115.29424 32.62020) |
| 10 | Aguascalientes | Y | Aguascalientes | 293152 | POINT (-102.18634 21.85335) |
| 11 | Campeche | Y | Campeche | 128434 | POINT (-90.54466 19.80399) |
| 12 | La Paz | Y | Baja California Sur | 91453 | POINT (-110.25386 24.18983) |
| 13 | Tuxtla Gutierrez | Y | Chiapas | 131096 | POINT (-92.99516 16.63030) |
| 14 | Chihuahua | Y | Chihuahua | 385603 | POINT (-105.97516 28.56030) |
| 15 | Saltillo | Y | Coahuila De Zaragoza | 284937 | POINT (-100.99583 25.44186) |
| 16 | Colima | Y | Colima | 86044 | POINT (-103.68410 19.21037) |
| 17 | Durango | Y | Durango | 257915 | POINT (-104.40000 24.02000) |
| 18 | Guanajuato | Y | Guanajuato | 48981 | POINT (-101.15000 21.01000) |
| 19 | Chilpancingo | Y | Guerrero | 67498 | POINT (-99.38337 17.35706) |
| 20 | Pachuca | Y | Hidalgo | 110351 | POINT (-98.70045 20.09706) |
| 21 | Morelia | Y | Michoacan de Ocampo | 297544 | POINT (-101.07320 19.66335) |
| 22 | Toluca | Y | Mexico | 199778 | POINT (-99.53128 19.32050) |
| 23 | Cuernavaca | Y | Morelos | 192770 | POINT (-99.18118 18.95008) |
| 24 | Tepic | Y | Nayarit | 145741 | POINT (-104.78242 21.53045) |
| 25 | Queretaro | Y | Queretaro de Arteaga | 215976 | POINT (-100.24117 20.50074) |
| 26 | Chetumal | Y | Quintana Roo | 56709 | POINT (-88.26436 18.55124) |
| 27 | San Luis Potosi | Y | San Luis Potosi | 470000 | POINT (-100.96924 22.13672) |
| 28 | Culiacan | Y | Sinaloa | 304826 | POINT (-107.45556 24.71334) |
| 29 | Hermosillo | Y | Sonora | 297175 | POINT (-110.83422 29.02044) |
| 30 | Villahermosa | Y | Tabasco | 158216 | POINT (-92.86255 17.96756) |
| 31 | Tlaxcala | Y | Tlaxcala | 35384 | POINT (-98.19723 19.27763) |
| 32 | Jalapa | Y | Veracruz-Llave | 204594 | POINT (-96.92548 19.46773) |
| 33 | Zacatecas | Y | Zacatecas | 80088 | POINT (-102.72294 22.75922) |
| 34 | Ciudad Victoria | Y | Tamaulipas | 140161 | POINT (-99.14811 23.73515) |
| 35 | Acapulco | N | Guerrero | 301902 | POINT (-99.93150 16.97439) |
z.plot();